#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back
#define vec vector<int>

int read(){int x = 0,sgn = 1;char ch = getchar();for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);return x*sgn;}

const int N = 5e3+10;
const int M = 210;

int a[N],b[M][N],n,m,stk[M][N],top[M];
ll ct[N],del[N],ans,s[N];

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in; m = in; for(int i = 2;i <= n;i++) a[i] = in,s[i] = s[i - 1] + a[i];
	for(int i = 1;i <= n;i++) for(int j = 1;j <= m;j++) b[j][i] = in;
	for(int i = 1;i <= m;i++) stk[i][top[i] = 1] = n + 1;
	for(int i = n;i >= 1;i--){
		for(int j = 1;j <= m;j++){
			del[i] += b[j][i]; del[i + 1] -= b[j][i];
			while(top[j] > 1 && b[j][i] >= b[j][stk[j][top[j]]]){
				del[stk[j][top[j]]] += b[j][i] - b[j][stk[j][top[j]]];
				del[stk[j][top[j] - 1]] -= b[j][i] - b[j][stk[j][top[j]]];
				top[j]--;
			}
			stk[j][++top[j]] = i;
		} ll tot = 0;
		for(int j = i;j <= n;j++) tot += del[j],ct[j] += tot,del[j] = 0,ans = max(ans,ct[j] - s[j] + s[i]);
	}printf("%lld\n",ans);
	return 0;
}
